<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center uploadUnitType_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub uploadUnitType_fd0_0'>
					<view class='flex flex-wrap align-center uploadUnitType_fd0_0_c0' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  uploadUnitType_fd0_0_c0_c0'>&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='uploadUnitType_fd0_0_c1_c0' v-if=" id=='1'">上传户型</text><text
							class='uploadUnitType_fd0_0_c1_c0' v-if=" id=='2'">编辑户型</text>
					</view>
					<view class='flex flex-wrap align-center justify-end uploadUnitType_fd0_0_c0'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout uploadUnitType_flex_1">
				<view class='flex flex-direction flex-wrap align-stretch uploadUnitType_fd1_0'>
					<view class='flex flex-direction flex-wrap align-stretch' v-if=" id=='2'">
						<view class='flex flex-wrap align-center justify-between uploadUnitType_fd1_0_c0_c0'
							@tap.stop="pickerDiy1695872868284=true">
							<text class='uploadUnitType_fd1_0_c0_c0_c0'>选择户型</text>
							<text class='uploadUnitType_fd1_0_c0_c0_c1'>{{hotelType_label}}</text>
							<image class='uploadUnitType_fd1_0_c0_c0_c2' mode="aspectFit" :src='STATIC_URL+"110.png"'>
							</image>
						</view>
						<view class='flex flex-wrap align-center justify-between uploadUnitType_fd1_0_c0_c0'
							@tap.stop="pickerDiy1695873705352=true">
							<text class='uploadUnitType_fd1_0_c0_c0_c0'>面积</text>
							<text class='uploadUnitType_fd1_0_c0_c0_c1'>150</text>
							<text class='uploadUnitType_fd1_0_c0_c0_c0'>㎡</text>
						</view>
						<view class='flex flex-wrap align-center justify-between uploadUnitType_fd1_0_c0_c0'>
							<text class='uploadUnitType_fd1_0_c0_c0_c0'>价格</text>
							<text class='uploadUnitType_fd1_0_c0_c2_c1'>约</text>
							<input class='uploadUnitType_fd1_0_c0_c2_c2' type="text" :placeholder="`请输入`"
								confirm-type="done" :maxlength="-1"
								placeholder-style="color:rgba(153, 153, 153, 1);font-size:32rpx" />
							<text class='uploadUnitType_fd1_0_c0_c2_c3'>万</text>
						</view>
					</view>
					<view class='flex flex-direction flex-wrap align-stretch'>
						<view class='flex flex-direction flex-wrap align-stretch uploadUnitType_fd1_0_c0_c0'>
							<view class='flex flex-wrap align-center uploadUnitType_fd1_0_c1_c0_c0'>
								<text class='uploadUnitType_fd1_0_c0_c0_c0'>上传户型图</text>
								<text class='uploadUnitType_fd1_0_c1_c0_c0_c1'>（最多</text>
								<text class='uploadUnitType_fd1_0_c1_c0_c0_c1'>1</text>
								<text class='uploadUnitType_fd1_0_c1_c0_c0_c1'>张图）</text>
							</view>
							<view class='flex flex-wrap align-center uploadUnitType_fd1_0_c1_c0_c1'>
								<image class="uploadUnitType_fd1_0_c1_c0_c1_c01" mode="aspectFit"
									@tap="soloChooseImage()"
									:src="tupian ? tupian : STATIC_URL+'134.png'"></image>
							</view>
						</view>
						<text class='uploadUnitType_fd1_0_c1_c1'>户型介绍</text>
						<view class='flex flex-wrap'>
							<textarea class='flex uploadUnitType_input_fd1_0_c1_c2' :placeholder="'请输入户型介绍'"
								:maxlength="240" placeholder-style="color:#999;font-size:28rpx" v-model="huxingjieshao" />

						</view>
					</view>
				</view>
				<button class='uploadUnitType_fd1_1' @click="goNavback()">确定</button>
			</view>

			<!---flex布局flex布局结束-->
			<!--面积选择器开始 -->
			<benben-picker ref="benbenWritePickerCodepicker2" :visible.sync="pickerDiy1695873705352" :options='hotel'
				mode='linkage' :mask-show='true' :timeout='true' :picker-height='88' :level='3' default-type='value'
				:default-props='{"label":"name","value":"value","children":"children"}'>
				<template #picker-header>
					<view class='flex flex-wrap align-center justify-between uploadUnitType_picker2_0'>
						<text class='uploadUnitType_picker2_0_c0'
							@tap="$refs.benbenWritePickerCodepicker2.cancel()">取消</text>
						<text class='uploadUnitType_picker2_0_c1'>选择户型</text>
						<text class='uploadUnitType_picker2_0_c2'
							@tap="$refs.benbenWritePickerCodepicker2.pickerConfirm()">确认</text>
					</view>
				</template>
			</benben-picker>
			<!--面积选择器结束 -->
			<!--选择器开始 -->
			<benben-picker ref="benbenWritePickerCodepicker3" :visible.sync="pickerDiy1695872868284"
				:label.sync='hotelType_label' :value.sync='hotelType_value' :options='hotelType' mode='selector'
				:mask-show='true' :timeout='true' :picker-height='88' default-type='value'
				:default-props='{"label":"name","value":"value"}'>
				<template #picker-header>
					<view class='flex flex-wrap align-center justify-between uploadUnitType_picker3_0'>
						<text class='uploadUnitType_picker3_0_c0'
							@tap="$refs.benbenWritePickerCodepicker3.cancel()">取消</text>
						<text class='uploadUnitType_picker3_0_c1'>选择户型</text>
						<text class='uploadUnitType_picker3_0_c2'
							@tap="$refs.benbenWritePickerCodepicker3.pickerConfirm()">确认</text>
					</view>
				</template>
			</benben-picker>
			<!--选择器结束 -->


		</view>
	</view>
</template>
<script>
	import UploadImage from '@/common/utils/upload-image.js'
	export default {
		components: {},
		data() {
			return {
				"tupian": '',
				"tupianId":'',
				"huxingjieshao":'',
				"pickerDiy1695872868284": false,
				"pickerDiy1695873705352": false,
				"fd1_0_c1_c2": "",
				"hotelType": [{
					"name": "A户型",
					"value": "1",
					"image": ""
				}, {
					"name": "B户型",
					"value": "2",
					"image": ""
				}, {
					"name": "C户型",
					"value": "3",
					"image": ""
				}, {
					"name": "D户型",
					"value": "4",
					"image": ""
				}],
				"hotelType_value": "",
				"hotelType_label": "A户型",
				"hotel": [{
					"name": "手机",
					"value": "1",
					"children": [{
						"name": "智能手机",
						"value": "1",
						"children": [{
							"name": "iPhone",
							"value": "1",
							"children": [{
								"name": "iPhone13",
								"value": "1"
							}]
						}]
					}]
				}, {
					"name": "电视",
					"value": "2",
					"children": [{
						"name": "液晶电视",
						"value": "1",
						"children": [{
							"name": "小米电视",
							"value": "1",
							"children": [{
								"name": "小米电视2",
								"value": "1"
							}]
						}]
					}]
				}, {
					"name": "空调",
					"value": "3",
					"children": [{
						"name": "变频空调",
						"value": "1",
						"children": [{
							"name": "挂机",
							"value": "1",
							"children": [{
								"name": "格力空调",
								"value": "1"
							}]
						}]
					}]
				}],
				"id": "2"
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			let {
				id
			} = options
			if (id !== undefined) this.id = id
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			soloChooseImage() {
				let self = this
				// 从相册中选择图片
				uni.chooseImage({
					count: 1, // 默认3
					sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
					success: function(res) {
						self.uploading = true
						// 开始上传
						new UploadImage(res.tempFiles, {
							complete: function(res) {
								self.uploading = false
								self.tupian = res[0].path;
								self.tupianId = res[0].id
							},
						})
					},
				})
			},
			goNavback(){
				let dataUnit = {
					tupian:this.tupian,
					tupianId:this.tupianId,
					huxingjieshao:this.huxingjieshao
				}
				uni.setStorageSync('dataUnits',dataUnit)
				uni.navigateBack({
					delta:1
				})
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;
	}

	.uploadUnitType_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.uploadUnitType_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
	}

	.uploadUnitType_fd0_0_c0_c0 {
		font-size: 36rpx;
		color: #333;
	}

	.uploadUnitType_fd0_0_c0 {
		width: 120rpx;
	}

	.uploadUnitType_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.uploadUnitType_flex_1 {
		padding: 24rpx 24rpx 0rpx 24rpx;
	}

	.uploadUnitType_fd1_1 {
		background: #FC5F80;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		width: 638rpx;
		line-height: 88rpx;
		font-size: 32rpx;
		color: #fff;
		height: 88rpx;
		font-weight: 500;
		position: fixed;
		bottom: calc(40rpx + var(--window-bottom));
		margin: 0rpx 0rpx 0rpx 32rpx;
	}

	.uploadUnitType_input_fd1_0_c1_c2 {
		width: 654%;
		height: 280rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: var(--benbenFontColor1);
		white-space: pre-wrap;
	}

	.uploadUnitType_fd1_0_c1_c1 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 400;
		margin: 32rpx 0rpx 24rpx 0rpx;
	}

	.uploadUnitType_fd1_0_c1_c0_c1_c01 {
		width: 210rpx;
		height: 210rpx;
		margin: 0rpx 12rpx 0rpx 0rpx;
		border-radius: 16rpx;
	}

	.uploadUnitType_fd1_0_c1_c0_c1_c001 {
		width: 210rpx;
		height: 210rpx;
		border-radius: 16rpx;
	}

	.uploadUnitType_fd1_0_c1_c0_c1_c000 {
		top: 10rpx;
		right: 10rpx;
		z-index: 10;
		color: rgba(242, 242, 242, 1);
		font-size: 40rpx;
	}

	.uploadUnitType_fd1_0_c1_c0_c1_c00 {
		margin: 0rpx 12rpx 0rpx 0rpx;
		border-radius: 16rpx;
	}

	.uploadUnitType_fd1_0_c1_c0_c1 {
		margin: 0rpx -12rpx 0rpx 0rpx;
	}

	.uploadUnitType_fd1_0_c1_c0_c0_c1 {
		color: #999999;
		font-size: 28rpx;
		font-weight: 400;
	}

	.uploadUnitType_fd1_0_c1_c0_c0 {
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.uploadUnitType_fd1_0_c0_c2_c3 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 400;
		margin: 0rpx 0rpx 0rpx 16rpx;
		line-height: 28rpx;
	}

	.uploadUnitType_fd1_0_c0_c2_c2 {
		text-align: right;
		margin: 0rpx 0rpx 0rpx 16rpx;
		width: 100rpx;
	}

	.uploadUnitType_fd1_0_c0_c2_c1 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 400;
		margin: 0rpx 0rpx 0rpx auto;
		line-height: 28rpx;
	}

	.uploadUnitType_fd1_0_c0_c0_c2 {
		width: 10rpx;
		height: 20rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx 25rpx;
	}

	.uploadUnitType_fd1_0_c0_c0_c1 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 400;
		margin: 0rpx 0rpx 0rpx auto;
	}

	.uploadUnitType_fd1_0_c0_c0_c0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 400;
	}

	.uploadUnitType_fd1_0_c0_c0 {
		border-bottom: 1px solid #eee;
		padding: 32rpx 0rpx 32rpx 0rpx;
	}

	.uploadUnitType_fd1_0 {
		background: var(--benbenbgColor1);
		padding: 0rpx 24rpx 32rpx 24rpx;
		border-radius: 16rpx;
		background-size: 100% auto;
	}

	.uploadUnitType_picker2_0_c2 {
		color: #FC5F80;
		font-size: 32rpx;
		font-weight: 500;
	}

	.uploadUnitType_picker2_0_c1 {
		color: #333333;
		font-size: 36rpx;
		font-weight: 500;
	}

	.uploadUnitType_picker2_0_c0 {
		color: #BFBFBF;
		font-size: 32rpx;
		font-weight: 500;
	}

	.uploadUnitType_picker2_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
		border-radius: 25rpx 25rpx 0rpx 0rpx;
		background-size: 100% auto !important;
	}

	.uploadUnitType_picker3_0_c2 {
		color: #FC5F80;
		font-size: 32rpx;
		font-weight: 500;
	}

	.uploadUnitType_picker3_0_c1 {
		color: #333333;
		font-size: 36rpx;
		font-weight: 500;
	}

	.uploadUnitType_picker3_0_c0 {
		color: #BFBFBF;
		font-size: 32rpx;
		font-weight: 500;
	}

	.uploadUnitType_picker3_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
		border-radius: 25rpx 25rpx 0rpx 0rpx;
		background-size: 100% auto !important;
	}
</style>